package builders;

import users.Person;
import users.UserAccount;

/**
 * Person builder.
 */
public class PersonBuilder implements IBuilderExampler<Person> {

    private String name;

    private String surname;

    private UserAccount userAccount;

    private String mail;

    public String getName() {
        return this.name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public String getSurname() {
        return this.surname;
    }

    public void setSurname(final String surname) {
        this.surname = surname;
    }

    public UserAccount getUserAccount() {
        return this.userAccount;
    }

    public void setUserAccount(final UserAccount userAccount) {
        this.userAccount = userAccount;
    }

    public String getMail() {
        return this.mail;
    }

    public void setMail(final String mail) {
        this.mail = mail;
    }

    @Override
    public Person build() {
        return new Person(this);
    }

    public PersonBuilder withName(final String aName) {
        this.name = aName;
        return this;
    }

    public PersonBuilder withSurname(final String aSurname) {
        this.surname = aSurname;
        return this;
    }

    public PersonBuilder withMail(final String aMail) {
        this.mail = aMail;
        return this;
    }

    public PersonBuilder withAccount(final UserAccount anAccount) {
        this.userAccount = anAccount;
        return this;
    }

    @Override
    public Person example() {
        return new PersonBuilder().withName("persisted person").withMail("a mail").withSurname("persisted surname")
                .withAccount(new UserAccountBuilder().example()).build();
    }
}
